﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page isELIgnored="false" %> 

<%@ page import="net.ssta.core.db.RecordSet"%>
<%@ page import="net.ssta.core.db.Record"%>
<%@ page import="net.ssta.core.web.RequestKit"%>
<%@ page import="net.ssta.core.db.PagingInfo"%>

<%
	String path = request.getContextPath();
	
	//分页参数
    PagingInfo pagingInfo =(PagingInfo) request.getAttribute("pagingInfo");
    int pageno = pagingInfo.getCurrentPageNo();
    //检索条件
    Record searchRcd = (Record) request.getAttribute("searchRcd");
	//获取技术需求列表
	RecordSet investSet = (RecordSet)request.getAttribute("investSet");
	//所属行业分类
    RecordSet newEnerClass = (RecordSet) request.getAttribute("newEnerClass");
	//代码、值Map
    Map fildOptionMap =  (HashMap)request.getAttribute("fildOptionMap");
	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<META http-equiv=x-ua-compatible content=ie=7>
<META content="MSHTML 6.00.6000.17107" name=GENERATOR>
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/css/commonStyle.css"/> 
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/styleBase.css"/>
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/ostable.css" />
<link type="text/css" rel="stylesheet" href="<%=path%>/includes/styleBase/css/tab.css" />

<link rel="stylesheet" href="<%=path%>/includes/lhgdialog/lhgdialog.css" />

<script type='text/javascript' src="<%=path%>/includes/js/jquery.js"></script>
<script type="text/javascript" src="<%=path%>/includes/styleBase/js/style.js"></script>

<script type="text/javascript" src="<%=path%>/includes/lhgdialog/lhgcore.min.js"></script>
<script type="text/javascript" src="<%=path%>/includes/lhgdialog/lhgdialog.js"></script>

<title>投融资项目审批</title>
 
<script type="text/javascript">
function doSearch()
{
	var form = document.getElementById("searchForm");
	form.submit();
}
function _checkpass(ifcheck){
	//var length =  $("input[type=checkbox]").length;
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	var tip = "您确定要将选中的技术需求信息设置为审核通过状态，设置后信息将在技术市场栏目中显示。"
	if(ifcheck=="2"){
		tip = "您确定要将选中的技术需求信息设置为审核不通过状态，设置后信息将不会在技术市场栏目中显示。"
	}
	var pids="";
	if(confirm(tip)){
		for(var i=0; i<ids.length; i++)
		{
			if(ids[i].checked) 
			{
				pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
			}
		}
		
		 $.ajax({
				type: "POST", url: "<%=path%>/back/market?method=investCheckStatus&ifcheck="+ifcheck+"&uuids="+pids,
				error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
				success: function(msg){
					alert("审批操作成功!");
					_goPage(<%=pageno%>);
				}
		 });
	}
}

function _recommend(ifrecommend){
	//var length =  $("input[type=checkbox]").length;
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	var tip = "您确定要将选中的投融资项目信息设置为推荐状态，设置后信息将在页面推荐栏目中显示。只有审批通过的投融资项目才能被推荐。"
	if(ifrecommend=="0"){
		tip = "您确定要将选中的投融资项目信息设置为不推荐状态，设置后信息将在取消在页面推荐栏目中的显示。"
	}
	var pids="";
	if(confirm(tip)){
		for(var i=0; i<ids.length; i++)
		{
			if(ids[i].checked) 
			{
				pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
			}
		}
		
		 $.ajax({
				type: "POST", url: "<%=path%>/back/market?method=investRecommend&recommend="+ifrecommend+"&uuids="+pids,
				error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
				success: function(msg){
					alert("推荐操作成功!");
					_goPage(<%=pageno%>);
				}
		 });
	}
}

function _delete(){
	//var length =  $("input[type=checkbox]").length;
	
	var ids= $("input[type='checkbox']");
	var length = 0;
	for(var i=0; i<ids.length; i++)
	{
		if(ids[i].checked) 
		{
			length++;
		}
	}
	
	if(length==0)
	{
		alert("请至少一条记录进行操作");
		return;
	}
	
	
	var pids="";
	if(confirm("您确定要删除所选中的信息？信息一旦删除将不能恢复！")){
		for(var i=0; i<ids.length; i++)
		{
			if(ids[i].checked) 
			{
				pids=pids+ids[i].value+',';  //如果选中，将value添加到变量pids中
			}
		}
		
		 $.ajax({
				type: "POST", url: "<%=path%>/back/market?method=investDelete&uuids="+pids,
				error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
				success: function(msg){
					alert("删除操作成功!");
					_goPage(<%=pageno%>);
				}
		 });
	}
}

function viewTechReq(uuid)
{
window.open("<%=path%>/back/market?method=investShow&uuid="+uuid,"投融资项目");
}

function _selectall(){
	var uuids = document.getElementsByName("uuid");
	if(uuids.length){
		for(var i=0;i<uuids.length;i++){
			uuids[i].checked = document.getElementById("selectall").checked;
		}
	}
}

</script>

</head>
<body>
<form id="searchForm" name="searchForm" action="<%=path%>/back/market">
	<input type="hidden" name="method" id="method" value="investList" />
	<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left">&nbsp;</td>
      <td class="box_top_center">投融资项目管理</td>
      <td class="box_top_right">&nbsp;</td>
    </tr>
  </table>
</div>
<div class="infoDiv">
  <table border="0" cellpadding="0" cellspacing="0" class="trHeightTable">
    <tr>
      <td class="leftTipArea">发布人</td>
      <td><input id="keyword" name="keyword" class="textInput" style="width:120px;" value="<%=searchRcd.getString("KEYWORD","")%>"/></td>
      <td class="leftTipArea">提交时间</td>
	  <td>
		<div class="select">
        <select name="SUBMITDATE" id="SUBMITDATE">
        	<option value="">全部</option>
        	<option value="1" <%if("1".equals(searchRcd.getString("SUBMITDATE",""))){%>selected<%}%>>当天</option>
            <option value="2" <%if("2".equals(searchRcd.getString("SUBMITDATE",""))){%>selected<%}%>>一周内</option>
            <option value="3" <%if("3".equals(searchRcd.getString("SUBMITDATE",""))){%>selected<%}%>>一月内</option>
            <option value="4" <%if("4".equals(searchRcd.getString("SUBMITDATE",""))){%>selected<%}%>>半年内</option>
        </select>
        </div>
      </td>
      <td class="leftTipArea">审批状态</td>
      <td>
      	<div><div>
        <select id="IFCHECK" name="IFCHECK">
      		<option value="">请选择</option>
      		<option value="0" <%if("0".equals(searchRcd.getString("IFCHECK","").trim())){%>selected<%}%>>未审批</option>
            <option value="1" <%if("1".equals(searchRcd.getString("IFCHECK","").trim())){%>selected<%}%>>审批通过</option>
            <option value="2" <%if("2".equals(searchRcd.getString("IFCHECK","").trim())){%>selected<%}%>>审批未通过</option>
      	</select>
        </div></div>
  	  </td>
      <td class="leftTipArea">是否推荐</td>
      <td>
      	<div><div>
        <select id="HOMEPAGESHOW" name="HOMEPAGESHOW">
      		<option value="">请选择</option>
      		<option value="0" <%if("0".equals(searchRcd.getString("HOMEPAGESHOW","").trim())){%>selected<%}%>>未推荐</option>
            <option value="1" <%if("1".equals(searchRcd.getString("HOMEPAGESHOW","").trim())){%>selected<%}%>>已推荐</option>
      	</select></div></div>
  	  </td>
  	  
    </tr>
    <tr>
      <td colspan="3"></td>
      <td colspan="3">
      	
      </td>
      <td colspan="2" height="40" align="right">
  	  	<table border="0" cellpadding="0" cellspacing="0" width="70">
        <tr>
        	<td><a href="javascript:doSearch();" class="imgButton"><span>查询</span></a></td>
        </tr>
        </table>
  	  </td>
    </tr>
  </table>
</div>
</form>

<div class="titleDiv">
  <table width="100%" cellpadding="0" cellspacing="0" border="0" style="text-align:left;">
    <tr>
      <td class="box_top_left" width="2">&nbsp;</td>
      <td class="box_top_center">查询结果列表</td>
      <td class="box_top_right" width="2">&nbsp;</td>
    </tr>
  </table>
</div>

<div class="contentBox">
    <table class="osTable" cellpadding="0" cellspacing="0" border="0">
      <thead>
        <tr >
          <th  width="2%" ><input type="checkbox" name="selectall" id="selectall" onclick="javascript:_selectall();" /></th>
          <th  width="15%" >投融资项目名称</th>
          <th  width="10%" >所属行业领域</th>
          <th  width="10%">合作方式</th>
          <th  width="15%">联系单位</th>
          <th  width="8%">联系人</th>
          <th  width="8%">联系人电话</th>
          <th  width="8%">手机</th>
          <th  width="8%">发布日期</th>
          <th  width="8%">审批状态</th>
          <th  width="8%">是否推荐</th>
        </tr>
      </thead>
      <tbody>
      <%
      	int i=0;
      	for(i=0;i<investSet.size();i++){
      		Record investRecord = investSet.get(i);
			//审批状态
      		String ifcheckcode=investRecord.getString("IFCHECK","0");
			String fontcolor = "red";
			String ifcheck = "未审批";
			if("1".equals(ifcheckcode)){ifcheck="审批通过";fontcolor="#000000";}else
			if("2".equals(ifcheckcode)){ifcheck="审核不通过"; fontcolor="#000000";}
			//是否推荐标识
			String homepageshow=("0".equals(investRecord.getString("HOMEPAGESHOW","0")))?"未推荐":"已推荐";
			//所属行业领域
         	String newenerclass="";
		    if(!investRecord.getString("NEWENERGYCLASS","").trim().equals("")){
		        newenerclass = (String)fildOptionMap.get("NEWENERGYCLASS"+(investRecord.getString("NEWENERGYCLASS","").trim()));
		    }
			
			String coperation="";
			if("1".equals(investRecord.getString("COOPERATEWAY",""))){coperation = "合资";}else
			if("2".equals(investRecord.getString("COOPERATEWAY",""))){coperation = "合作";}else
			if("3".equals(investRecord.getString("COOPERATEWAY",""))){coperation = "技术引进";}else
			if("4".equals(investRecord.getString("COOPERATEWAY",""))){coperation = "设备引进";}else
			if("5".equals(investRecord.getString("COOPERATEWAY",""))){coperation = "补偿贸易";}else
			if("6".equals(investRecord.getString("COOPERATEWAY",""))){coperation = "产权转让";}else
			{coperation = "面议";}
			String submitdate = investRecord.getString("SUBMITDATE","");
			if(!"".equals(submitdate) && submitdate.length()>10){
				submitdate = submitdate.substring(0,10);
			}
      	%>
            <tr >
              <td><input type="checkbox" id="uuid" name="uuid" value="<%=investRecord.getString("ID","")%>"/></td>
              <td><a href="#" onClick="viewTechReq('<%=investRecord.getString("ID","")%>');" style="color:<%=fontcolor%>;"><%=investRecord.getString("TITLE","")%></a></td>
              <td  style="color:<%=fontcolor%>;"><%=newenerclass%></td>
              <td  style="color:<%=fontcolor%>;"><%=coperation%></td>
              <td  style="color:<%=fontcolor%>;"><%=investRecord.getString("LINKUNIT","")%></td>
              <td  style="color:<%=fontcolor%>;"><%=investRecord.getString("LINKMAN","")%></td>
              <td  style="color:<%=fontcolor%>;"><%=investRecord.getString("TEL","")%></td>
              <td  style="color:<%=fontcolor%>;"><%=investRecord.getString("CELLPHONE","")%></td>
              <td  style="color:<%=fontcolor%>;"><%=submitdate%></td>
              <td  style="color:<%=fontcolor%>;"><%=ifcheck%></td>
              <td  style="color:<%=fontcolor%>;"><%=homepageshow%></td>
            </tr>
        <%
		}
		for(int j=0;j<pagingInfo.getPageSize()-investSet.size();j++){ 
		%>
		<tr >
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
          <td >&nbsp;</td>
		</tr>
        <%
		}
		%>
      </tbody>
    </table>
	<div class="navDiv">
        <div  class="navRightDiv">
            <jsp:include flush="true" page="/common/paging.jsp"></jsp:include>
        </div>
	</div>
    <div class="navDiv">
        <div class="navLeftDiv">
        <a href="#2010" class="imgButton" onclick="javascript:_checkpass('1');"><span>审批通过</span></a>
        <a href="#2010" class="imgButton" onclick="javascript:_checkpass('2');"><span>审批不通过</span></a>
        <a href="#2010" class="imgButton" onclick="javascript:_recommend('1');"><span>推荐</span></a>
        <a href="#2010" class="imgButton" onclick="javascript:_recommend('0');"><span>撤销推荐</span></a>
        <a href="#2010" class="imgButton" onclick="javascript:_delete();"><span>删除</span></a>
        </div>
	</div>
</div>

</body> 
</html>